﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AddEdit.aspx.cs" Inherits="CardLogistics.Web.MainPage.Purchase.Contract.AddEdit" %>

<%@ Register Src="../../../Controls/WebUserControl_Nav.ascx" TagName="WebUserControl_Nav"
    TagPrefix="uc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>采购合同_新增编辑</title>
    <link href="../../../css/style.css" rel="stylesheet" type="text/css" />
    <link href="../../../css/selPage.css" rel="stylesheet" type="text/css" />
    <script src="../../../js/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
    <script src="../../../js/valReq.js" type="text/javascript"></script>
    <script src="../../../js/jquery.js" type="text/javascript"></script>
    <script src="../../../js/jquery.tipswindow.2.0.js" type="text/javascript"></script>
    <script type="text/javascript" language="javascript">
        function valReq(issubmit) {
            var altStr = valid_isempty('CONNO', '合同编号');
            altStr += valid_isempty('CONNAME', '合同名称');
            altStr += valid_isempty('billno', '需求单');
            altStr += valid_isempty_select('ddlSUPPID', '供应商');
            altStr += valid_isempty('SIGNDATE', '签定日期');
            altStr += valid_isempty('BEDATE', '生效日期');
            altStr += valid_isempty('DELIVERYDAYS', '供货期');
            altStr += valid_isempty_select('ddlBUYTYPEID', '采购类型');
            altStr += getSumInfo();
            altStr += valid_isempty('hf_ConId', '明细信息');
            //判断供卡批次是否重复
            if (batchNo() == "err")
                return false;
            //校验单价输入是否正确
            if (reqPrice() == "err")
                return false;
             //校验合同数量输入是否正确
            if (reqNum() == "err")
                return false;
            if (altStr != "") {
                alert(altStr);
                return false;
            }
            else {
                if (issubmit == 1) {
                    if (confirm("提交后该信息进入待审批状态不可编辑,确认提交吗?") == true) {
                        return true;
                    }
                    else
                        return false;
                }
                else
                    return true;
            }
        }

        //判断供卡批次是否重复
        function batchNo() {
            var data = $("#hf_ConId").val().split('|');
            for (var i = 0; i < data.length; i++) {
                var temp = data[i].split(';')[0]; //供卡批次号
                for (var j = i + 1; j < data.length; j++) {
                    var batch = data[j].split(';')[0]; //供卡批次号
                    if (temp == batch) {
                        alert("供卡批次不可重复!");
                        return "err";
                    }
                }
            }
        }
        //校验合同数量输入是否正确
        function reqNum() {
            var dnum = parseInt($("#DemandCardTotal").val()); //需求总数
            var cnum = parseInt($("#ConCardTotal").val()); //合同数量
            var bcnum = GetSumByName("CurrCardTotal"); //当前数量
            var ednum = parseInt($("#hfEditSumCard").val()); //编辑时总数
            var ynum = dnum - cnum + ednum; //本次合同数量=需求总数-合同数量+编辑的数量
            if (bcnum == 0) {
                alert("合同数量不可为0,请填写合同明细!");
                return "err";
            }
            if (bcnum <= ynum) {
                return "";
            }
            else {
                alert("当前合同数量" + bcnum + "不可大于" + ynum + ",请核对!");
                return "err";
            }
        }
        
        //校验单价输入是否正确
        function reqPrice() {
            var obj = document.getElementsByName("Price")[0].value;
            var re = /^\d+(?=\.{0,1}\d+$|$)/;
            if (!re.test(obj)) {
                alert("单价【" + obj + "】输入有误,请核对!");
                return "err";
            }
        }
    </script>
    <script type="text/javascript">
        $(document).ready(function () {    //选择需求单
            $("#billno").click(function () {
                $.tipsWindow({
                    ___title: "选择需求单",
                    ___content: "iframe:../../SelectPage/SelDemand.aspx",
                    ___width: "1000",
                    ___height: "500",
                    ___drag: "___boxTitle",
                    ___showbg: true
                });
            });
        })

        function getSumInfo() {
            var pricsum = 0; //单价
            var cardsum = 0; //数量
            var spasum = 0; //备品数量
            var presum = 0; //赠品数量
            var Firstsum = 0; //首付款
            var Acceptsum = 0; //验收款
            var Qualitysum = 0; //质保金
            var strBasciType = ""; //芯片类型
            var errInfo = "";
            var CosVersion = $("input[name=CosVersion]");
            var Price = $("input[name=Price]");
            var CardAmount = $("input[name=CardAmount]"); //数量
            var Spareparts = $("input[name=Spareparts]"); //备品
            var Premiums = $("input[name=Premiums]"); //赠品
            var BatchNO = $("input[name=BatchNO]");
            var FirstPayment = $("input[name=FirstPayment]"); //首付款
            var Acceptance = $("input[name=Acceptance]"); //验收款
            var QualityAssurance = $("input[name=QualityAssurance]"); //质保金
            var money = 0; //金额=单价*数量
            var dataval = "";
            $("select[name=BasicType] option:selected").each(function (i, o) {
                if (Trim($(BatchNO[i]).val()) != "0" && $(BatchNO[i]).val() != "") {
                    //金额=单价*数量
                    money = parseFloat(Trim($(Price[i]).val())) * parseInt(Trim($(CardAmount[i]).val()));
                    $(Spareparts[i]).val((parseInt(parseInt(Trim($(CardAmount[i]).val())) * 0.003)).toString()); //备品数量（3/1000）
                    $(FirstPayment[i]).val(parseFloat((money * 0.4).toString()).toFixed(2)); //首付款(40%）
                    $(Acceptance[i]).val(parseFloat((money * 0.5).toString()).toFixed(2)); //验收款(50%)
                    $(QualityAssurance[i]).val(parseFloat((money * 0.1).toString()).toFixed(2)); //质保金(10%)
                    pricsum += parseFloat(Trim($(Price[i]).val())) * parseInt(Trim($(CardAmount[i]).val()));
                    cardsum += parseInt(Trim($(CardAmount[i]).val()));
                    spasum += parseInt(Trim($(Spareparts[i]).val())); //备品数量
                    presum += parseInt(Trim($(Premiums[i]).val()));
                    Firstsum += parseFloat(Trim($(FirstPayment[i]).val())); //首付款合计
                    Acceptsum += parseFloat(Trim($(Acceptance[i]).val())); //验收款合计
                    Qualitysum += parseFloat(Trim($(QualityAssurance[i]).val())); //质保金合计
                    strBasciType += Trim($(this).val()) + ",";
                    dataval += Trim($(BatchNO[i]).val()) + ";" + Trim($(this).val()) + ";" + Trim($(CosVersion[i]).val()) + ";" + Trim($(Price[i]).val()) + ";"
                + Trim($(CardAmount[i]).val()) + ";" + Trim($(Spareparts[i]).val()) + ";" + Trim($(Premiums[i]).val()) + ";"
                 + Trim($(FirstPayment[i]).val()) + ";" + Trim($(Acceptance[i]).val()) + ";" + Trim($(QualityAssurance[i]).val()) + "|";

                    if (Trim($(BatchNO[i]).val()) == "0" || Trim($(BatchNO[i]).val()) == "" || Trim($(this).val()) == "0" || Trim($(this).val()) == "" || Trim($(CosVersion[i]).val()) == "0" || Trim($(CosVersion[i]).val()) == "" ||
                    Trim($(Price[i]).val()) == "" || Trim($(Price[i]).val()) == "0" || Trim($(CardAmount[i]).val()) == "" || Trim($(CardAmount[i]).val()) == "0") {
                        errInfo += "第" + (i+1).toString() + "行明细不可为空\n";
                    } 
                }
            });

            $("#hf_ConId").val(dataval);
            document.getElementById("dpricsum").innerHTML =pricsum.toFixed(2);
            document.getElementById("dcardsum").innerHTML = cardsum; //卡片数量
            document.getElementById("dspasum").innerHTML = spasum; //备品数量
            document.getElementById("dpresum").innerHTML = presum; //赠品数量
            document.getElementById("dFirstsum").innerHTML = Firstsum.toFixed(2); //首付款合计赋值
            document.getElementById("dAcceptsum").innerHTML = Acceptsum.toFixed(2); //验收款合计赋值
            document.getElementById("dQualitysum").innerHTML = Qualitysum.toFixed(2); //质保金合计赋值
            document.getElementById("CurrCardTotal").value = cardsum + spasum + presum; //当前数量=卡片数量+备品数量+赠品数量
            return errInfo;
        }

        $(document).ready(function () {    //选择需求单
            $("input[name=CardAmount]").keyup(function () {
                getSumInfo();
            });
        });
        //编辑时绑定信息
        function BindDetailInfo() {
            var BatchNO = $("input[name=BatchNO]");
            var BasicType = $("select[name=BasicType]");
            var CosVersion = $("input[name=CosVersion]");
            var Price = $("input[name=Price]");
            var CardAmount = $("input[name=CardAmount]");
            var Spareparts = $("input[name=Spareparts]");
            var Premiums = $("input[name=Premiums]");
            var FirstPayment = $("input[name=FirstPayment]"); //首付款
            var Acceptance = $("input[name=Acceptance]"); //验收款
            var QualityAssurance = $("input[name=QualityAssurance]"); //质保金
            var dataval = $("#hf_ConId").val();
            var str1 = dataval.split("|");
            for (var i = 0; i < str1.length; i++) {
                if (str1[i] != "") {
                    $(BatchNO[i]).val(str1[i].split(";")[0]);
                    $(BasicType[i]).val(str1[i].split(";")[1]);
                    $(CosVersion[i]).val(str1[i].split(";")[2]);
                    $(Price[i]).val(str1[i].split(";")[3]);
                    $(CardAmount[i]).val(str1[i].split(";")[4]);
                    $(Spareparts[i]).val(str1[i].split(";")[5]);
                    $(Premiums[i]).val(str1[i].split(";")[6]);
                    $(FirstPayment[i]).val(str1[i].split(";")[7]);
                    $(Acceptance[i]).val(str1[i].split(";")[8]);
                    $(QualityAssurance[i]).val(str1[i].split(";")[9]);
                }
            }
            getSumInfo();
        }
        window.onload = function () { BindDetailInfo(); }

    </script>
</head>
<body>
    <form id="Form1" runat="server">
    <uc1:WebUserControl_Nav ID="WebUserControl_Nav1" runat="server" />
    <input type="hidden" id="DemandCardTotal" runat="server" />
    <input type="hidden" id="ConCardTotal" runat="server" />
    <input type="hidden" id="CurrCardTotal" runat="server" />
    <input type="hidden" id="hfEditSumCard" runat="server" />
    <%=TitleName %>
    <table class="theFormM" width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
            <td class="titleTxtM">
                合同编号：
            </td>
            <td>
                <input id="CONNO" runat="server" type="text" class="dfinputNoEmpM" maxlength="15" />
            </td>
            <td class="titleTxtM">
                合同名称：
            </td>
            <td>
                <input id="CONNAME" runat="server" type="text" class="dfinputNoEmpM" maxlength="25" />
            </td>
            <td class="titleTxtM">
                需求单：
            </td>
            <td>
                <input id="billno" readonly="readonly" runat="server" type="text" class="dfinputImgM"
                    maxlength="25" />
                <asp:HiddenField ID="hf_DEMANDID" runat="server" />
                <asp:HiddenField ID="hf_CARDTYPES" runat="server" />
            </td>
            <td class="titleTxtM">
                供应商：
            </td>
            <td>
                <select name="ddlSUPPID" id="ddlSUPPID" class="dfinputNoEmpM" runat="server">
                </select>
            </td>
        </tr>
        <tr>
            <td class="titleTxtM">
                签定日期：
            </td>
            <td>
                <input id="SIGNDATE" runat="server" type="text" class="Wdate" onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})"
                    style="width: 95%" />
            </td>
            <td class="titleTxtM">
                生效日期：
            </td>
            <td class="contentTxtM">
                <input id="BEDATE" runat="server" type="text" class="Wdate" onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})"
                    style="width: 95%" />
            </td>
            <td class="titleTxtM">
                供货期(天)：
            </td>
            <td>
                <input id="DELIVERYDAYS" runat="server" type="text" class="dfinputNoEmpM" maxlength="10"
                    onkeydown="onlyNum();" />
            </td>
            <td class="titleTxtM">
                采购类型：
            </td>
            <td>
                <select name="ddlBUYTYPEID" id="ddlBUYTYPEID" class="dfinputNoEmpM" runat="server">
                </select>
            </td>
        </tr>
        <tr>
            <td class="titleTxtM">
                卡片种类：
            </td>
            <td>
                <input id="CARDTYPE" runat="server" type="text" class="dfinputM" maxlength="25" />
            </td>
            <td class="titleTxtM">
                签定地点：
            </td>
            <td>
                <input id="SIGNADDRESS" runat="server" type="text" class="dfinputM" maxlength="100" />
            </td>
            <td class="titleTxtM">
                负责人：
            </td>
            <td>
                <input id="CONPIC" runat="server" type="text" class="dfinputM" maxlength="25" />
            </td>
            <td class="titleTxtM">
                &nbsp;
            </td>
            <td class="contentTxtM" colspan="2">
                &nbsp;<input type="hidden" id="hf_ConId" name="hf_ConId" runat="server" />
            </td>
        </tr>
        <tr>
            <td class="titleTxtM">
                备注：
            </td>
            <td colspan="7">
                <input id="REMARK" runat="server" type="text" class="dfinputM" maxlength="200" style="width: 98%" />
            </td>
        </tr>
        <tr>
            <td colspan="8">
                <div class="ddetail" style="height: 270px;">
                    <table class="tabledetail" id="tb_Detail">
                        <tr>
                            <th width="65px">
                                序号
                            </th>
                            <th width="110px">
                                供卡批次
                            </th>
                            <th width="130px">
                                芯片类型
                            </th>
                            <th width="110px">
                                Cos版本号
                            </th>
                            <th width="110px">
                                单价(元)
                            </th>
                            <th width="110px">
                                数量
                            </th>
                            <th width="110px">
                                备品数量
                            </th>
                            <th width="110px">
                                赠品数量
                            </th>
                            <th width="110px">
                                首付款(40%）
                            </th>
                            <th width="110px">
                                验收款(50%)
                            </th>
                            <th width="110px">
                                质保金(10%)
                            </th>
                            <th>
                                &nbsp;
                            </th>
                        </tr>
                        <tr>
                            <td align="center">
                                1
                            </td>
                            <td>
                                <input name="BatchNO" type="text" class="dfinput" value="" maxlength="15" />
                            </td>
                            <td>
                                <select name="BasicType" class="dfinput">
                                    <option value="0"></option>
                                    <%foreach (var BasicType in BasicTypeList)
                                      {%>
                                    <option value="<%=BasicType.Key %>">
                                        <%=BasicType.Value%></option>
                                    <% }%>
                                </select>
                            </td>
                            <td align="center">
                                <input name="CosVersion" type="text" class="dfinput" value="" maxlength="5" />
                            </td>
                            <td align="center">
                                <input name="Price" type="text" class="dfinput" value="0" onkeydown="onlyPrice();"
                                    maxlength="5" />
                            </td>
                            <td align="center">
                                <input name="CardAmount" type="text" class="dfinput" value="0" onkeydown="onlyNum();"
                                    maxlength="7" />
                            </td>
                            <td align="center">
                                <input name="Spareparts" type="text" class="dfinput" value="0" onkeydown="onlyNum();"
                                    maxlength="5" />
                            </td>
                            <td align="center">
                                <input name="Premiums" type="text" class="dfinput" value="0" onkeydown="onlyNum();"
                                    maxlength="5" />
                            </td>
                            <td align="center">
                                <input name="FirstPayment" type="text" class="dfinput" value="0" onkeydown="onlyNum();"
                                    maxlength="7" />
                            </td>
                            <td align="center">
                                <input name="Acceptance" type="text" class="dfinput" value="0" onkeydown="onlyNum();"
                                    maxlength="7" />
                            </td>
                            <td align="center">
                                <input name="QualityAssurance" type="text" class="dfinput" value="0" onkeydown="onlyNum();"
                                    maxlength="7" />
                            </td>
                            <td>
                                &nbsp;
                            </td>
                        </tr>
                        <tr>
                            <td align="center">
                                2
                            </td>
                            <td>
                                <input name="BatchNO" type="text" class="dfinput" value="" maxlength="15" />
                            </td>
                            <td>
                                <select name="BasicType" class="dfinput">
                                    <option value="0"></option>
                                    <%foreach (var BasicType in BasicTypeList)
                                      {%>
                                    <option value="<%=BasicType.Key %>">
                                        <%=BasicType.Value%></option>
                                    <% }%>
                                </select>
                            </td>
                            <td align="center">
                                <input name="CosVersion" type="text" class="dfinput" value="" maxlength="5" />
                            </td>
                            <td align="center">
                                <input name="Price" type="text" class="dfinput" value="0" onkeydown="onlyPrice();"
                                    maxlength="5" />
                            </td>
                            <td align="center">
                                <input name="CardAmount" type="text" class="dfinput" value="0" onkeydown="onlyNum();"
                                    maxlength="7" />
                            </td>
                            <td align="center">
                                <input name="Spareparts" type="text" class="dfinput" value="0" onkeydown="onlyNum();"
                                    maxlength="5" />
                            </td>
                            <td align="center">
                                <input name="Premiums" type="text" class="dfinput" value="0" onkeydown="onlyNum();"
                                    maxlength="5" />
                            </td>
                            <td align="center">
                                <input name="FirstPayment" type="text" class="dfinput" value="0" onkeydown="onlyNum();"
                                    maxlength="7" />
                            </td>
                            <td align="center">
                                <input name="Acceptance" type="text" class="dfinput" value="0" onkeydown="onlyNum();"
                                    maxlength="7" />
                            </td>
                            <td align="center">
                                <input name="QualityAssurance" type="text" class="dfinput" value="0" onkeydown="onlyNum();"
                                    maxlength="7" />
                            </td>
                            <td>
                                &nbsp;
                            </td>
                        </tr>
                        <tr>
                            <td align="center">
                                3
                            </td>
                            <td>
                                <input name="BatchNO" type="text" class="dfinput" value="" maxlength="15" />
                            </td>
                            <td>
                                <select name="BasicType" class="dfinput">
                                    <option value="0"></option>
                                    <%foreach (var BasicType in BasicTypeList)
                                      {%>
                                    <option value="<%=BasicType.Key %>">
                                        <%=BasicType.Value%></option>
                                    <% }%>
                                </select>
                            </td>
                            <td align="center">
                                <input name="CosVersion" type="text" class="dfinput" value="" maxlength="5" />
                            </td>
                            <td align="center">
                                <input name="Price" type="text" class="dfinput" value="0" onkeydown="onlyPrice();"
                                    maxlength="5" />
                            </td>
                            <td align="center">
                                <input name="CardAmount" type="text" class="dfinput" value="0" onkeydown="onlyNum();"
                                    maxlength="7" />
                            </td>
                            <td align="center">
                                <input name="Spareparts" type="text" class="dfinput" value="0" onkeydown="onlyNum();"
                                    maxlength="5" />
                            </td>
                            <td align="center">
                                <input name="Premiums" type="text" class="dfinput" value="0" onkeydown="onlyNum();"
                                    maxlength="5" />
                            </td>
                            <td align="center">
                                <input name="FirstPayment" type="text" class="dfinput" value="0" onkeydown="onlyNum();"
                                    maxlength="7" />
                            </td>
                            <td align="center">
                                <input name="Acceptance" type="text" class="dfinput" value="0" onkeydown="onlyNum();"
                                    maxlength="7" />
                            </td>
                            <td align="center">
                                <input name="QualityAssurance" type="text" class="dfinput" value="0" onkeydown="onlyNum();"
                                    maxlength="7" />
                            </td>
                            <td>
                                &nbsp;
                            </td>
                        </tr>
                        <tr>
                            <td align="center">
                                4
                            </td>
                            <td>
                                <input name="BatchNO" type="text" class="dfinput" value="" maxlength="15" />
                            </td>
                            <td>
                                <select name="BasicType" class="dfinput">
                                    <option value="0"></option>
                                    <%foreach (var BasicType in BasicTypeList)
                                      {%>
                                    <option value="<%=BasicType.Key %>">
                                        <%=BasicType.Value%></option>
                                    <% }%>
                                </select>
                            </td>
                            <td align="center">
                                <input name="CosVersion" type="text" class="dfinput" value="" maxlength="5" />
                            </td>
                            <td align="center">
                                <input name="Price" type="text" class="dfinput" value="0" onkeydown="onlyPrice();"
                                    maxlength="5" />
                            </td>
                            <td align="center">
                                <input name="CardAmount" type="text" class="dfinput" value="0" onkeydown="onlyNum();"
                                    maxlength="7" />
                            </td>
                            <td align="center">
                                <input name="Spareparts" type="text" class="dfinput" value="0" onkeydown="onlyNum();"
                                    maxlength="5" />
                            </td>
                            <td align="center">
                                <input name="Premiums" type="text" class="dfinput" value="0" onkeydown="onlyNum();"
                                    maxlength="5" />
                            </td>
                            <td align="center">
                                <input name="FirstPayment" type="text" class="dfinput" value="0" onkeydown="onlyNum();"
                                    maxlength="7" />
                            </td>
                            <td align="center">
                                <input name="Acceptance" type="text" class="dfinput" value="0" onkeydown="onlyNum();"
                                    maxlength="7" />
                            </td>
                            <td align="center">
                                <input name="QualityAssurance" type="text" class="dfinput" value="0" onkeydown="onlyNum();"
                                    maxlength="7" />
                            </td>
                            <td>
                                &nbsp;
                            </td>
                        </tr>
                        <tr>
                            <td align="center">
                                5
                            </td>
                            <td>
                                <input name="BatchNO" type="text" class="dfinput" value="" maxlength="15" />
                            </td>
                            <td>
                                <select name="BasicType" class="dfinput">
                                    <option value="0"></option>
                                    <%foreach (var BasicType in BasicTypeList)
                                      {%>
                                    <option value="<%=BasicType.Key %>">
                                        <%=BasicType.Value%></option>
                                    <% }%>
                                </select>
                            </td>
                            <td align="center">
                                <input name="CosVersion" type="text" class="dfinput" value="" maxlength="5" />
                            </td>
                            <td align="center">
                                <input name="Price" type="text" class="dfinput" value="0" onkeydown="onlyPrice();"
                                    maxlength="5" />
                            </td>
                            <td align="center">
                                <input name="CardAmount" type="text" class="dfinput" value="0" onkeydown="onlyNum();"
                                    maxlength="7" />
                            </td>
                            <td align="center">
                                <input name="Spareparts" type="text" class="dfinput" value="0" onkeydown="onlyNum();"
                                    maxlength="5" />
                            </td>
                            <td align="center">
                                <input name="Premiums" type="text" class="dfinput" value="0" onkeydown="onlyNum();"
                                    maxlength="5" />
                            </td>
                            <td align="center">
                                <input name="FirstPayment" type="text" class="dfinput" value="0" onkeydown="onlyNum();"
                                    maxlength="7" />
                            </td>
                            <td align="center">
                                <input name="Acceptance" type="text" class="dfinput" value="0" onkeydown="onlyNum();"
                                    maxlength="7" />
                            </td>
                            <td align="center">
                                <input name="QualityAssurance" type="text" class="dfinput" value="0" onkeydown="onlyNum();"
                                    maxlength="7" />
                            </td>
                            <td>
                                &nbsp;
                            </td>
                        </tr>
                        <tr>
                            <td align="center">
                                6
                            </td>
                            <td>
                                <input name="BatchNO" type="text" class="dfinput" value="" maxlength="15" />
                            </td>
                            <td>
                                <select name="BasicType" class="dfinput">
                                    <option value="0"></option>
                                    <%foreach (var BasicType in BasicTypeList)
                                      {%>
                                    <option value="<%=BasicType.Key %>">
                                        <%=BasicType.Value%></option>
                                    <% }%>
                                </select>
                            </td>
                            <td align="center">
                                <input name="CosVersion" type="text" class="dfinput" value="" maxlength="5" />
                            </td>
                            <td align="center">
                                <input name="Price" type="text" class="dfinput" value="0" onkeydown="onlyPrice();"
                                    maxlength="5" />
                            </td>
                            <td align="center">
                                <input name="CardAmount" type="text" class="dfinput" value="0" onkeydown="onlyNum();"
                                    maxlength="7" />
                            </td>
                            <td align="center">
                                <input name="Spareparts" type="text" class="dfinput" value="0" onkeydown="onlyNum();"
                                    maxlength="5" />
                            </td>
                            <td align="center">
                                <input name="Premiums" type="text" class="dfinput" value="0" onkeydown="onlyNum();"
                                    maxlength="5" />
                            </td>
                            <td align="center">
                                <input name="FirstPayment" type="text" class="dfinput" value="0" onkeydown="onlyNum();"
                                    maxlength="7" />
                            </td>
                            <td align="center">
                                <input name="Acceptance" type="text" class="dfinput" value="0" onkeydown="onlyNum();"
                                    maxlength="7" />
                            </td>
                            <td align="center">
                                <input name="QualityAssurance" type="text" class="dfinput" value="0" onkeydown="onlyNum();"
                                    maxlength="7" />
                            </td>
                            <td>
                                &nbsp;
                            </td>
                        </tr>
                        <tr>
                            <td align="center">
                                7
                            </td>
                            <td>
                                <input name="BatchNO" type="text" class="dfinput" value="" maxlength="15" />
                            </td>
                            <td>
                                <select name="BasicType" class="dfinput">
                                    <option value="0"></option>
                                    <%foreach (var BasicType in BasicTypeList)
                                      {%>
                                    <option value="<%=BasicType.Key %>">
                                        <%=BasicType.Value%></option>
                                    <% }%>
                                </select>
                            </td>
                            <td align="center">
                                <input name="CosVersion" type="text" class="dfinput" value="" maxlength="5" />
                            </td>
                            <td align="center">
                                <input name="Price" type="text" class="dfinput" value="0" onkeydown="onlyPrice();"
                                    maxlength="5" />
                            </td>
                            <td align="center">
                                <input name="CardAmount" type="text" class="dfinput" value="0" onkeydown="onlyNum();"
                                    maxlength="7" />
                            </td>
                            <td align="center">
                                <input name="Spareparts" type="text" class="dfinput" value="0" onkeydown="onlyNum();"
                                    maxlength="5" />
                            </td>
                            <td align="center">
                                <input name="Premiums" type="text" class="dfinput" value="0" onkeydown="onlyNum();"
                                    maxlength="5" />
                            </td>
                            <td align="center">
                                <input name="FirstPayment" type="text" class="dfinput" value="0" onkeydown="onlyNum();"
                                    maxlength="7" />
                            </td>
                            <td align="center">
                                <input name="Acceptance" type="text" class="dfinput" value="0" onkeydown="onlyNum();"
                                    maxlength="7" />
                            </td>
                            <td align="center">
                                <input name="QualityAssurance" type="text" class="dfinput" value="0" onkeydown="onlyNum();"
                                    maxlength="7" />
                            </td>
                            <td>
                                &nbsp;
                            </td>
                        </tr>
                        <tr>
                            <td align="center">
                                8
                            </td>
                            <td>
                                <input name="BatchNO" type="text" class="dfinput" value="" maxlength="15" />
                            </td>
                            <td>
                                <select name="BasicType" class="dfinput">
                                    <option value="0"></option>
                                    <%foreach (var BasicType in BasicTypeList)
                                      {%>
                                    <option value="<%=BasicType.Key %>">
                                        <%=BasicType.Value%></option>
                                    <% }%>
                                </select>
                            </td>
                            <td align="center">
                                <input name="CosVersion" type="text" class="dfinput" value="" maxlength="5" />
                            </td>
                            <td align="center">
                                <input name="Price" type="text" class="dfinput" value="0" onkeydown="onlyPrice();"
                                    maxlength="5" />
                            </td>
                            <td align="center">
                                <input name="CardAmount" type="text" class="dfinput" value="0" onkeydown="onlyNum();"
                                    maxlength="7" />
                            </td>
                            <td align="center">
                                <input name="Spareparts" type="text" class="dfinput" value="0" onkeydown="onlyNum();"
                                    maxlength="5" />
                            </td>
                            <td align="center">
                                <input name="Premiums" type="text" class="dfinput" value="0" onkeydown="onlyNum();"
                                    maxlength="5" />
                            </td>
                            <td align="center">
                                <input name="FirstPayment" type="text" class="dfinput" value="0" onkeydown="onlyNum();"
                                    maxlength="7" />
                            </td>
                            <td align="center">
                                <input name="Acceptance" type="text" class="dfinput" value="0" onkeydown="onlyNum();"
                                    maxlength="7" />
                            </td>
                            <td align="center">
                                <input name="QualityAssurance" type="text" class="dfinput" value="0" onkeydown="onlyNum();"
                                    maxlength="7" />
                            </td>
                            <td>
                                &nbsp;
                            </td>
                        </tr>
                        <tr>
                            <td align="center">
                                9
                            </td>
                            <td>
                                <input name="BatchNO" type="text" class="dfinput" value="" maxlength="15" />
                            </td>
                            <td>
                                <select name="BasicType" class="dfinput">
                                    <option value="0"></option>
                                    <%foreach (var BasicType in BasicTypeList)
                                      {%>
                                    <option value="<%=BasicType.Key %>">
                                        <%=BasicType.Value%></option>
                                    <% }%>
                                </select>
                            </td>
                            <td align="center">
                                <input name="CosVersion" type="text" class="dfinput" value="" maxlength="5" />
                            </td>
                            <td align="center">
                                <input name="Price" type="text" class="dfinput" value="0" onkeydown="onlyPrice();"
                                    maxlength="5" />
                            </td>
                            <td align="center">
                                <input name="CardAmount" type="text" class="dfinput" value="0" onkeydown="onlyNum();"
                                    maxlength="7" />
                            </td>
                            <td align="center">
                                <input name="Spareparts" type="text" class="dfinput" value="0" onkeydown="onlyNum();"
                                    maxlength="5" />
                            </td>
                            <td align="center">
                                <input name="Premiums" type="text" class="dfinput" value="0" onkeydown="onlyNum();"
                                    maxlength="5" />
                            </td>
                            <td align="center">
                                <input name="FirstPayment" type="text" class="dfinput" value="0" onkeydown="onlyNum();"
                                    maxlength="7" />
                            </td>
                            <td align="center">
                                <input name="Acceptance" type="text" class="dfinput" value="0" onkeydown="onlyNum();"
                                    maxlength="7" />
                            </td>
                            <td align="center">
                                <input name="QualityAssurance" type="text" class="dfinput" value="0" onkeydown="onlyNum();"
                                    maxlength="7" />
                            </td>
                            <td>
                                &nbsp;
                            </td>
                        </tr>
                        <tr>
                            <td align="center">
                                10
                            </td>
                            <td>
                                <input name="BatchNO" type="text" class="dfinput" value="" maxlength="15" />
                            </td>
                            <td>
                                <select name="BasicType" class="dfinput">
                                    <option value="0"></option>
                                    <%foreach (var BasicType in BasicTypeList)
                                      {%>
                                    <option value="<%=BasicType.Key %>">
                                        <%=BasicType.Value%></option>
                                    <% }%>
                                </select>
                            </td>
                            <td align="center">
                                <input name="CosVersion" type="text" class="dfinput" value="" maxlength="5" />
                            </td>
                            <td align="center">
                                <input name="Price" type="text" class="dfinput" value="0" onkeydown="onlyPrice();"
                                    maxlength="5" />
                            </td>
                            <td align="center">
                                <input name="CardAmount" type="text" class="dfinput" value="0" onkeydown="onlyNum();"
                                    maxlength="7" />
                            </td>
                            <td align="center">
                                <input name="Spareparts" type="text" class="dfinput" value="0" onkeydown="onlyNum();"
                                    maxlength="5" />
                            </td>
                            <td align="center">
                                <input name="Premiums" type="text" class="dfinput" value="0" onkeydown="onlyNum();"
                                    maxlength="5" />
                            </td>
                            <td align="center">
                                <input name="FirstPayment" type="text" class="dfinput" value="0" onkeydown="onlyNum();"
                                    maxlength="7" />
                            </td>
                            <td align="center">
                                <input name="Acceptance" type="text" class="dfinput" value="0" onkeydown="onlyNum();"
                                    maxlength="7" />
                            </td>
                            <td align="center">
                                <input name="QualityAssurance" type="text" class="dfinput" value="0" onkeydown="onlyNum();"
                                    maxlength="7" />
                            </td>
                            <td>
                                &nbsp;
                            </td>
                        </tr>
                    </table>
                </div>
                <table class="tablesum">
                    <tr>
                        <th width="65px">
                            &nbsp;
                        </th>
                        <th width="111px" style="text-align: center;">
                            合计
                        </th>
                        <th width="130px">
                            &nbsp;
                        </th>
                        <th width="111px" style="text-align: right;">
                            总价:
                        </th>
                        <th width="111px" style="text-align: right;" id="dpricsum">
                            0
                        </th>
                        <th width="111px" style="text-align: right;" id="dcardsum">
                            0
                        </th>
                        <th width="111px" style="text-align: right;" id="dspasum">
                            0
                        </th>
                        <th width="111px" style="text-align: right;" id="dpresum">
                            0
                        </th>
                        <th width="111px" style="text-align: right;" id="dFirstsum">
                            0
                        </th>
                        <th width="111px" style="text-align: right;" id="dAcceptsum">
                            0
                        </th>
                        <th width="111px" style="text-align: right;" id="dQualitysum">
                            0
                        </th>
                        <th>
                            &nbsp;
                        </th>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td colspan="8" align="center" style="height: 60px;">
                 <asp:Button ID="btn_Submit" CssClass="btn" runat="server" Text="保存并提交" OnClientClick="return valReq(1);"
                    OnClick="btn_Submit_Click" />
                <asp:Button ID="btn_Add" CssClass="btn" runat="server" Text="保存" OnClientClick="return valReq(0);"
                    OnClick="btn_Add_Click" />
                <input type="button" class="btn" value="返回" onclick="javascript:history.go(-1);" />
            </td>
        </tr>
    </table>
    </form>
</body>
</html>
